//
//  WmcClassifyAlbumSecondLevelVM.swift
//  YPWatermarkCamera
//
//  Created by 周诗松 on 2022/5/14.
//

import Foundation

class WmcClassifyAlbumSecondLevelVM: WmcBaseVM {
    
    private(set) lazy var dataSource: [WmcMediaPhotographStatisticsModel] = []
    
    /// 是否需要刷新数据
    var dataNeedUpdate: (() -> Void)?
    
    func fetchList(completion: @escaping ([WmcMediaPhotographStatisticsModel]) -> Void, failure: @escaping (Error?) -> Void) {
        WmcMediaAlbumAPI.fetchTakePhotoStatistics().subscribe(onNext: { [weak self] list in
            guard let weakSelf = self else { return }
            weakSelf.dataSource = list
            completion(list)
        }, onError: { error in
            failure(error)
        }).disposed(by: rx.disposeBag)
    }
}
